import { _decorator, Component, EventKeyboard, input, Input, Node, sys } from 'cc';
import * as flatted from 'flatted'

const { ccclass, property } = _decorator;

@ccclass('load')
export class load extends Component {
    start() {
        input.on(Input.EventType.KEY_DOWN, this.keyDown, this);
    }

    update(deltaTime: number) {

    }

    keyDown(key: EventKeyboard) {
        let native = sys.localStorage.getItem('save');
        const deserialized = flatted.parse(native);
        let n = deserialized as Node
        
        // this.node.addChild(n);
        console.log(n);
        console.log(this.node);
    }
}


